<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="../assets/js/vue.js"></script>
</head>
<body>
    <div id="app">
        <p>{{ user }}</p>
        <input type="text" v-model="user.name">
        <input type="text" v-model="user.age">
        <input type="button" value="重新设置user值" @click="user={name:'rick',age:18}">

    </div>
    <script>
        new Vue({
            el:"#app",
            data:{
                user:{
                    name:"tom",
                    age:18
                }    
            },
            methods: {
                
            },
            watch:{
                // user:function(){
                //     console.log("user发生变化")
                // },
                // "user.age":function(){
                //     console.log("user.age发生变化")
                // },
                    user:{
                        handler:function(){

                        },
                    }
            }
        })
    </script>
</body>
</html>